from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
d=webdriver.Firefox()
d.get('http://sahitest.com/demo/index.htm')
d.get_screenshot_as_file('E:\\蓬莱小课2024测试\\img1.png')
link1=d.find_element_by_link_text('Alert Test')
sleep(2)
link1.click()
sleep(2)
d.get_screenshot_as_file('E:\\蓬莱小课2024测试\\img2.png')
d.quit()